
#ifndef CHATPROJECT_ANIMATIONSTACKEDWIDGET_H
#define CHATPROJECT_ANIMATIONSTACKEDWIDGET_H

#include <QStackedWidget>

class AnimationStackedWidget : public QStackedWidget
{
    Q_OBJECT
    //  Qt属性基于Qt元数据对象系统
    Q_PROPERTY(float rotate_value READ getRotateValue WRITE setRotateValue)
    Q_PROPERTY(float start_value READ getStartValue WRITE setStartValue)
    Q_PROPERTY(float stop_value READ getStopValue WRITE setStopValue)
public:
    explicit AnimationStackedWidget(QWidget *parent = nullptr);
    ~AnimationStackedWidget() override;

    void animation(int pageIndex);
    void setRotateValue(float value) { rotate_val_ = value; }
    float getRotateValue() { return rotate_val_; }
    void setStartValue(float value) { start_val_ = value; }
    float getStartValue() { return start_val_; }
    void setStopValue(float value) { stop_val_ = value; }
    float getStopValue() { return stop_val_; }

protected:
    void paintEvent(QPaintEvent *event) override;
    void valueChanged(const QVariant &value);
    void finished();

private:
    float    rotate_val_;
    float    start_val_;
    float    stop_val_;
    int      page_index_;
    QPixmap  pix_current_;
    QPixmap  pix_next_;
};


#endif //CHATPROJECT_ANIMATIONSTACKEDWIDGET_H
